﻿using System.Data;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using Dapper;
using Microsoft.EntityFrameworkCore;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Oracle.ManagedDataAccess.Client;
using ZXing;
using ZXing.Common;
using MyConsole;
using my_console;
using System.Runtime.CompilerServices;
using System.Threading.Tasks.Dataflow;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using ZXing.QrCode;
using System.Drawing;
using System.Drawing.Imaging;
using Microsoft.Data.SqlClient;
using OfficeOpenXml;
using System.Xml.Serialization;
using System.Xml;
using System.Xml.Linq;
using System.Linq;
using System.Security.Cryptography;
using StackExchange.Redis;

// token问题
// M1();
// 获取token用户信息问题
// M2();

// null值排序问题
// M3();

// ElasticSearch
// M4();

// M5();

// M9();

// M10();

// M11();

// M12();

// M20();

// M21();

// M22();

// M23();

// M24();

// M25();

// M26();

// M27();

// M28();

// M29();

// M30();

// M31();

// M32();

// M33();

// M34();

// M35();

// M36();

// M37();

// M38();

// M39();

// M40();

// M41();

// M42();

// M43();

// M44();

// M45();

// M46();

// M47();

// M48();

// M49();

// M50();

// M51();

// M52();

// M53();

// M54();

// M55();

// M56();

// M57();

// M58();

// M59();

// M60();

// M62();

// M63();

// M64();

// M65();

// M67();

// M69();

// M70();

// M71();

// M72();

// M73();

// M74();

// M75();

// M76();

// M78();

// M79();

// M80();
// M81();
// M82();
// M83();
// M84();
// M85();
// M86();
// M87();
// M88();
// M89();
// M90();
// M91();
// M92();
// M93();
M94();

Console.ReadLine();

// JWT
static async void M1()
{
    using var http = new HttpClient();
    using var content = new FormUrlEncodedContent(
        new[]
        {
            new KeyValuePair<string, string>("client_id", "clientPC"),
            new KeyValuePair<string, string>("client_secret", "000000"),
            new KeyValuePair<string, string>("grant_type", "client_credentials"),
        }
    );

    var res = await http.PostAsync("http://127.0.0.1:9500/connect/token", content);
    var result = await res.Content.ReadAsStringAsync();
    System.Console.WriteLine(result);
}

// JWT
static async void M2()
{
    using var http = new HttpClient();
    http.DefaultRequestHeaders.Add(
        "Authorization",
        "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkEwN0REQjk3MDgxNkJCRjI2NjhGMzEyRjUzNzI0RjI4IiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MTYxMzM3NjcsImV4cCI6MTYxNjEzNzM2NywiaXNzIjoiaHR0cDovLzEyNy4wLjAuMTo5NTAwIiwiY2xpZW50X2lkIjoiY2xpZW50UEMiLCJqdGkiOiJEMzJDNDI0MjNDRkU2RTY0RDMzOTQwQUNBQ0M5RkEzNCIsImlhdCI6MTYxNjEzMzc2Nywic2NvcGUiOlsiQ291cnNlIiwiU3R1ZGVudCJdfQ.XNZDBMt1hb9AsRHEHP_hCYjlBaGfcekGJGqlbVoZmhMYIlzwI9WTGKtaGctfeWNv5BmJZMC8KvR6Js1qmd8Dqx2yNaMaCjf-edzQCX-km1NwhwccNAB13XSHHVHVdngXzrbZYVPsbIrjfZmY4GghXyF1nMYJt5ZBWectcHE7KalZ707Datv9sM-2SZyOtUnE2IKe_gnz20Cdex_SZjN8AWy9WlUq0-SvtzWXHsJID2IHM-gpul6R-as3jFPAVk3bUJMHnJetM8FCcInDv_hOkdNOG7b43SMjdGeNMMXBnzkZ5klQawoZbQ19PHvjx3TAa_jdnFSMEMmQi3YzFWr01Q"
    );
    // http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkEwN0REQjk3MDgxNkJCRjI2NjhGMzEyRjUzNzI0RjI4IiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MTYxMjM3MDgsImV4cCI6MTYxNjEyNzMwOCwiaXNzIjoiaHR0cDovLzEyNy4wLjAuMTo5NTAwIiwiY2xpZW50X2lkIjoiY2xpZW50UEMiLCJqdGkiOiIwNTYxMzUxMzdENjc1QUE1ODY5OTJEMjc5OUU0NUQ4MyIsImlhdCI6MTYxNjEyMzcwOCwic2NvcGUiOlsiQ291cnNlIiwiU3R1ZGVudCJdfQ.ai8wV0s1Kn34CCgEgQppEFmVm3o9zQ79V8G-cKaYVhkYUCbFBCYsBF1uQAVIy1yPqHlBuMq7GfxeboaDY_Parx3XF0nZmHYxYas7j5zFLjAOM86ETb3iMvLDZMEQdDEUm-mYVQxTnjnF9OEJC7ceBMlziekqF5-5FWChZ04_UvnpdH5gexTZG_eNNpGS6FQyd2ec-RlTolO6qOvUFB23WJfJACvqWZNgezKlU0xJ-94LbmJNYeNRY8_CZ0mpbPEy3-Jy9UEXddYEkSvsTlecP2N0yyDSMsl9r5H567fXyj7023SXUsbIcC0SEiaTAWDc9XHcQlTbKyhLqs1UA67QLw");
    var res = await http.GetAsync("http://127.0.0.1:5000/student/home/1");
    var result = await res.Content.ReadAsStringAsync();
    Console.WriteLine(result);
}

// 空值排序
static void M3()
{
    var a = new List<Person>
    {
        new Person { Name = "孙远杰", Sort = 2 },
        new Person { Name = "华天晓", Sort = 1 },
        new Person { Name = "孙小双", Sort = null },
        new Person { Name = "李怡然", Sort = null },
        new Person { Name = "尹晓畅", Sort = 3 },
    };
    System.Console.WriteLine(JsonConvert.SerializeObject(a.OrderBy(b => b.Sort == null)));
}

// 索引的语法糖
static void M4()
{
    var a = new List<int> { 1, 2, 3, 4, 5, 67, 576, 7, 464, 353, 25, 435, 436, 5, 6777777 };
    System.Console.WriteLine(a[^10]);
}

#region Mongo

// mongodb的使用
static void M5()
{
    var service = new MongoClient("mongodb://root:000000@81.68.253.181:27017");
    var db = service.GetDatabase("MyDb");
    // var list = books.Find(a => a.BookName.Contains("C")).ToList();
    // list.ForEach(a => System.Console.WriteLine(JsonConvert.SerializeObject(a)));
    // M6(db.GetCollection<BsonDocument>("Books"));
    M8(db.GetCollection<BsonDocument>("Books"));
}

// 查询
static async void M6(IMongoCollection<BsonDocument> books)
{
    var filter = Builders<BsonDocument>.Filter;
    var list = await books.Find(filter.Exists("Children")).ToListAsync();
    list.ForEach(a => System.Console.WriteLine(a));
}

// 排序
static async void M7(IMongoCollection<BsonDocument> books)
{
    var filter = Builders<BsonDocument>.Filter;
    var sort = Builders<BsonDocument>.Sort;
    var list = await books
        .Find(filter.Lt("Price", 100))
        .Sort(sort.Descending("Price"))
        .ToListAsync();
    list.ForEach(a => System.Console.WriteLine(a));
}

// 查询指定字段
static async void M8(IMongoCollection<BsonDocument> books)
{
    var proj = Builders<BsonDocument>.Projection;
    var list = await books
        .Find(a => true)
        .Project(proj.Include("Name").Include("Price").Exclude("_id"))
        .ToListAsync();
    list.ForEach(a => System.Console.WriteLine(a));
}

static void M9()
{
    System.Console.WriteLine($"{"hehe"}{4:000}");
}

static void M10()
{
    System.Console.WriteLine((int)OrderStatus.Arrival);
    System.Console.WriteLine((int)OrderStatus.Pay);
    System.Console.WriteLine((int)OrderStatus.Cancel);
    System.Console.WriteLine((int)OrderStatus.Eatting);
}

static void M11()
{
    System.Console.WriteLine(Convert.ToDateTime("2018-11-23").Ticks);
}

static async void M12()
{
    await Task.Delay(5000);
    System.Console.WriteLine(JsonConvert.SerializeObject(new { name = "孙小双" }));
}

#endregion


static void M20()
{
    A a = new B();
    a.Say2();
}

static void M21()
{
    var a = new[]
    {
        1,
        2,
        4,
        35,
        4,
        564,
        675,
        76,
        87,
        68,
        656,
        54,
        643,
        5234,
        5,
        4356,
        47,
        67,
        65,
        76,
        87,
        68,
        768,
        567,
        456,
        546,
        45,
        6
    };
    var arr = a.OrderBy(b => b);
    System.Console.WriteLine(JsonConvert.SerializeObject(arr));
    System.Console.WriteLine(arr.Take(10).Max());
}

static void M22()
{
    var service = new MongoClient("mongodb://ris_admin:hinacom@192.168.1.80:27017");
    var proj = Builders<BsonDocument>.Projection
        .Include("MarkName")
        .Include("LastUpdateTime")
        .Exclude("_id");
    var db = service.GetDatabase("Statistics");
    // var list = books.Find(a => a.BookName.Contains("C")).ToList();
    // list.ForEach(a => System.Console.WriteLine(JsonConvert.SerializeObject(a)));
    // M6(db.GetCollection<BsonDocument>("Books"));
    var ww = db.GetCollection<BsonDocument>("StatisticSyncMark")
        .Find(a => true)
        .Project(proj)
        .ToList();
    System.Console.WriteLine(JsonConvert.SerializeObject(ww));
}

static void M23()
{
    var db = new MyDbContext();
    var conn = db.Database.GetDbConnection();
}

// 写条形码
static void M24()
{
    var writer = new BarcodeWriter();
    writer.Format = BarcodeFormat.CODE_128;
    EncodingOptions options = new EncodingOptions()
    {
        Width = 200,
        Height = 80,
        Margin = 2
    };
    writer.Options = options;
    var b = writer.Write("CT2107160001");
    b.Save($"./{DateTime.Now:yyyyMMddHHmmss}.png");
    b.Dispose();

    // writer.Format =

    // var writer = new BarcodeWriter<int>();
    // //使用ITF 格式，不能被现在常用的支付宝、微信扫出来
    // //如果想生成可识别的可以使用 CODE_128 格式
    // //writer.Format = BarcodeFormat.ITF;
    // writer.Format = BarcodeFormat.CODE_128;
    // EncodingOptions options = new EncodingOptions()
    // {
    //     Width = 200,
    //     Height = 80,
    //     Margin = 2
    // };
    // writer.Options = options;
    // var b = writer.Write("CT2107160001");
    // b.Save($"./{DateTime.Now:yyyyMMddHHmmss}.png");
    // b.Dispose();
}

static void M25()
{
    // Environment.SetEnvironmentVariable("ORACLE_HOME", "E:\\Oracle\\OracleClient");
    // Environment.SetEnvironmentVariable("NLS_LANG", "American_America.US7ASCII");


    var sql = "select * from appoint where rownum<10";
    // using var conn = new System.Data.OracleClient.OracleConnection("User Id=hhris;Password=hinacom;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.200.175)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=RIS2)))");
    // using var conn = new Oracle.ManagedDataAccess.Client.OracleConnection("User Id=hhris;Password=hinacom;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.200.175)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=RIS2)))");
    using var conn = new System.Data.OleDb.OleDbConnection(
        "Provider=OraOLEDB.Oracle;User Id=hhris;Password=hinacom;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.200.175)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=RIS2)))"
    );

    var res = conn.Query(sql);
    foreach (var item in res)
    {
        System.Console.WriteLine(item.NAME);
    }
}

static void M26()
{
    using var conn = new OracleConnection(
        "User Id=root;Password=hinacom;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.200.175)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=RIS)))"
    );
    var data = conn.Query("select * from exam.exam_master where rownum<11");
    foreach (var item in data)
    {
        System.Console.WriteLine(item.NAME);
    }
}

static void M27()
{
    var dd = DateTime.Now;
    DateTime zero = new(1970, 1, 1, 0, 0, 0, 0);
    System.Console.WriteLine(Convert.ToInt32((dd - zero).TotalSeconds));
}

static void M28()
{
    var dd = "12 岁";
    System.Console.WriteLine(Regex.Replace(dd, @"[^0-9]+", ""));
}

static void M29()
{
    var ww = "{name: '华天晓', age: 22}";
    var dd = ww.Insert(ww.LastIndexOf('}'), "wwww");
    System.Console.WriteLine(dd);
}

static void M30()
{
    var content = File.ReadAllText("./hh.json");
    var json = JObject.Parse(content);
    var dic = new Dictionary<string, string>();
    LoadKeyValues(json);

    // System.Console.WriteLine(dic);
    foreach (var item in dic)
    {
        // System.Console.WriteLine($"{item.Key}\t{item.Value}");
        File.AppendAllText("wwww.txt", $"{item.Key}\t{item.Value}{Environment.NewLine}");
    }

    void LoadKeyValues(JObject token, string prefix = "")
    {
        foreach (var item in token)
        {
            if (item.Value is JObject)
            {
                LoadKeyValues(item.Value as JObject, prefix + item.Key + ".");
                continue;
            }
            if (dic.ContainsKey(item.Key))
                continue;
            dic.Add(prefix + item.Key, item.Value.ToString().Replace("\r\n", "").Trim());
        }
    }
}

static void M31()
{
    var rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
    var buff = new byte[8];
    rng.GetBytes(buff);
    var salt = Convert.ToBase64String(buff);
    System.Console.WriteLine(salt);
}

static async void M32()
{
    using var http = new HttpClient();
    http.DefaultRequestHeaders.Add(
        "Authorization",
        "Bearer "
            + "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJoYWluYS1yaXMtZGV2Iiwic2NvcGUiOlsiYWxsIl0sImV4cCI6MTYzMTY4MjYwMywiYXV0aG9yaXRpZXMiOlsiUk9MRV9BTk9OWU1PVVMiXSwianRpIjoiMzdiMWM2NDQtMzYyYS00NTk5LWE4N2ItYTAzZjE2MWFlMjZkIiwiY2xpZW50X2lkIjoiaGFpbmEtcmlzLWRldiJ9.ObFs4DzmO4PUsawZ4gQjEb53PSR_RbFlOUT4PX0HSFk1imj9k1ZIkqIHUNc8xvGuznFP4rTsi770P8pdkobchZIHxz-ZGZrxk1kRaZ2jrGxuuf_eGZ5SSqx0294h-KtuMbwrMUeR_5tJw0K6OKH_Hd7ZDU9PBVoPnGoq9fB4vDc246oS7lBA-BgneUcUQB-LSeHFRsDWubZCT7eNsEMFUrJ57wxVhoq8xbXbZxumpZXCxULpAbRhf4QiZSzA31Pcib8IVcVucKaKAxuEJ747mp5QokrrFRx4l5wlDLciAfgKhlKjKV_hsVj6LEKCGt-DxLUnCKHXi0lcIhkzlx2xzA"
    );
    // http.DefaultRequestHeaders.Add("Context-Type", "application/json");
    var url = "http://220.182.43.122:8090/tdf-service-data/v1.0/patientInfo";
    var body = new StringContent("{\"orgCode\": 11000004, \"searchKey\": \"张\"}");
    // body.Headers.Add("Context-Type", "application/json");
    body.Headers.ContentType = new MediaTypeHeaderValue("application/json");
    var res = await http.PostAsync(url, body);
    var content = await res.Content.ReadAsStringAsync();
    System.Console.WriteLine(content);
}

static void M33()
{
    var dt = DateTime.Now;
    var dto = new DateTimeOffset(dt);
    System.Console.WriteLine((dt - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds);
    System.Console.WriteLine(dt);
    System.Console.WriteLine(dto.ToUnixTimeSeconds());
    System.Console.WriteLine(dto);
    // System.Console.WriteLine();
}

static void M34()
{
    var ww = "孙小双";
    // var buffer = System.Text.Encoding.UTF8.GetBytes(ww);
    // var ss = new MD5CryptoServiceProvider();
    // var aa = BitConverter.ToString(ss.ComputeHash(buffer));
    // var bb = aa.Replace("-", "");
    // System.Console.WriteLine(new Guid(bb));
}

static async void M35()
{
    var url = "http://www.jiandanmao.cn/1.pdf";
    using var http = new HttpClient();

    // var httpRequestMessage = new System.Net.Http.HttpRequestMessage();
    // httpRequestMessage.Method = new System.Net.Http.HttpMethod("GET");
    // httpRequestMessage.Headers.Add("context-type", "application/pdf");
    // httpRequestMessage.RequestUri = new Uri(url);
    // var res = await http.SendAsync(httpRequestMessage);

    var res = await http.GetAsync(url);
    res.EnsureSuccessStatusCode();
    var ww = await res.Content.ReadAsStreamAsync();
    var buffer = new byte[ww.Length];
    await ww.ReadAsync(buffer, 0, buffer.Length);
    await File.WriteAllBytesAsync($"./{DateTimeOffset.Now:yyyyMMddHHmmss}.pdf", buffer);
}

static async void M36()
{
    // 读取单个人物
    // Dictionary<string, string> dicParam = new Dictionary<string, string>();
    // dicParam.Add("id", "1");
    // using var http = new HttpClient();
    // var res = await http.PostAsync("http://localhost:9010/WebService1.asmx/GetPerson", new FormUrlEncodedContent(dicParam));
    // var content = await res.Content.ReadAsStringAsync();

    // 读取所有人物
    // using var http = new HttpClient();
    // var res = await http.PostAsync("http://localhost:9010/WebService1.asmx/GetPersons", null);
    // var content = await res.Content.ReadAsStringAsync();
    // var doc = new XmlDocument();
    // doc.LoadXml(content);
    // var result = doc.InnerText;
    // System.Console.WriteLine(result);

    // 增加一个人物
    Dictionary<string, string> dicParam = new Dictionary<string, string>();
    dicParam.Add("name", "李怡然");
    dicParam.Add("age", "23");
    using var http = new HttpClient();
    var res = await http.PostAsync(
        "http://localhost:9010/WebService1.asmx/AddPerson",
        new FormUrlEncodedContent(dicParam)
    );
    var content = await res.Content.ReadAsStringAsync();
}

static void M37()
{
    var t = typeof(string);
    System.Console.WriteLine(t.Name);
}

static void M38()
{
    var dt = new DataTable("sunxsh");
    dt.Columns.Add("Name");
    dt.Columns.Add("Age");
    dt.Columns.Add("Code");
    var dr = dt.NewRow();
    dr["Name"] = "孙小双";
    dr["Age"] = 33;
    dt.Rows.Add(dr);
    using (var writer = new StringWriter())
    {
        dt.WriteXml(writer, XmlWriteMode.WriteSchema);
        System.Console.WriteLine(writer.ToString());
    }
}

static void M39()
{
    var ww = "|| ";
    var www = ww.Split(new[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
    foreach (var w in www)
    {
        System.Console.WriteLine(w);
    }
}

static void M40()
{
    var ww =
        "R0lGODlhfgATAPcAAP8AAP8AOv86AP86Ov8AZv9mAP9mOv86kP9mkP9mtv+QOv+QZv+2Zv+QkP+Qtv+2kP+Q2/+22/+2///bkP/btv//tv/b2//b////2////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABkALAAAAAB+ABMAAAj/ADMIHEiwoMGDCBMqXMiwocOHCAsAkKAgwAWBBQ4IxCAAAASGDACI/AixpMGQEjBOrHgxQ8aNHUkqDDlyIEcCCSsAIEBTpMiUNwkqAJDgpMehGk0qnUB0oE6ePn0CFYBz4NCiBUNCQOoUQNKDCnhazHCTQQALVAly9JjVo86vZDvWtCmXbVuZBZ8WDGv2YtmzaenaHaj1LUGtMwM8AAw1QOCBErESZos4LlGddtcmwCxT4lyDQ1OeVMw4pOOqkJsepjyY41i6Vc0+AHA6pIPHBJlG3f0zQ8jYOwX+Fh6coES8XVEH9a2YNlXbuAfq5h1VtG/V0r2ano3gOYDbqBUy/5WcGivmlJEFnjc+eDV5pge2A+gOFXzD8Qj1qhVwoMCA5vRBF9511qmHHUyZxbQWSQuyh5xKeHHU33/ceWffagVmoBN5+71GUAUBLACghYFN5xVdA5z4YW+WbcaiZg4atFaGGoY4Yn0lRvUVRynCVZBENE4g1mzgCbgXABHUFYABxXU1UXnrqUTecTJ2FOSQ35E44FBJ+rRkkwZRuVcCZi2QJY5bPnldUQV4qOGLHbmoJoypPTgjaGSGeKaRQqkZEptuspehThCUiaSWR4r253URxoQgBA1ahpeYP7b3ZqF6JolmosQVVVlBdxr4U0UCvBYSfYkyAFVRhrFnXm/pvcapJoQHLSrqSo6ZOl90oam6aKt5gSkQS5Z5uJxVADTg0Z+qAqlAUsNdB9y0lT745pZjrWUsr8kuS1SzK8Flq3HAJfnascOKVNRQP8H3kpRRunQZiwhymFqBBZRbakvoZsDuulK5u+O+oO674bUwpenYZ/KqaBnDazHsmU8PAuvaBQfr1+9QC7fn2VefGhcABQ63aaZIA1JasMNKPfRpmyR/ZbJPKVsqWFLAGjWgVYE2RGzLEIU22c7D9swQS/0CrfTSTDfdUEAAOw==";

    byte[] bytes = Convert.FromBase64String(ww);
    var aa = Encoding.Default.GetString(bytes);
    System.Console.WriteLine(aa);
    using var ss = new FileStream(
        $"./{DateTime.Now:yyyyMMddHHmmss}.png",
        FileMode.Create,
        FileAccess.Write
    );
    ss.Write(bytes, 0, bytes.Length);
}

static void M41()
{
    var ww =
        "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNC4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAgLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiIFsNCgk8IUVOVElUWSBuc19mbG93cyAiaHR0cDovL25zLmFkb2JlLmNvbS9GbG93cy8xLjAvIj4NCl0+DQo8c3ZnIHZlcnNpb249IjEuMSINCgkgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sbnM6YT0iaHR0cDovL25zLmFkb2JlLmNvbS9BZG9iZVNWR1ZpZXdlckV4dGVuc2lvbnMvMy4wLyINCgkgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI5MXB4IiBoZWlnaHQ9IjMzcHgiIHZpZXdCb3g9IjAgNi45OTMgOTEgMzMiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCA2Ljk5MyA5MSAzMyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8ZGVmcz4NCjwvZGVmcz4NCjxnPg0KCTxnPg0KCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTgzLDIzYy0wLjg5MSwwLjQ0My0xLjc4OSwwLjg3OC0yLDJjMS41MDYsMC45NTcsNS4xODMsMC44MSw5LDANCgkJCWMzLjExNiw0LjM1NS0xLjkxNyw3LjY3LTMsMTFjLTMuNDY1LDAuMTMyLTUuODA2LTAuODYxLTUtNWMxLjkzMSw2LjE0NSw2LjIwNywwLjU4Nyw3LTNjLTguODMxLTMuODE1LTcuOTkzLDEwLjY2Mi0xNywxMA0KCQkJYzIuNzcyLTEuODk1LDUuMzI0LTQuMDA5LDctN2MtMC4zLTEuODExLTQuMjA3LDEuMDEyLTUsMmMtMi41MzUtMi42MDIsMy43MzYtNC44ODEsNy01Yy0xLjU3Mi0wLjc2MS0xLjQ5NC0zLjE3My00LTMNCgkJCWMwLjcyNy0wLjk1OSw0LjY5My01Ljg2MSwyLTRjLTMuMTg3LTEuOTgsMi4wMTYtMy44OSw1LTNjLTAuMTA5LDIuNDg4LTEuODc0LDMuMDk2LDAsNWMyLjI2Ny0xLjA2NywzLjYzNC0zLjAzMyw0LTYNCgkJCWMtNS42NDQtMi4xNzQtMTYuOTQ0LDEuMjYzLTEzLDljLTUuNTYzLTAuMTE1LTEuNDYyLTUuMzUzLTItOWMzLjA1NiwwLjcyMywzLjY0NS0xLjAyMiw2LTFjLTQuNzAyLTEuNjE3LTEuMTQ5LTIuNjE5LDEtNQ0KCQkJYy0wLjMxLTEuMzU3LTIuNTA0LTAuODMtNC0xYy0wLjMyNy0zLjQ1MSw1LjIyNC0zLjY1OCw3LTJjLTEuNzU4LDMuNDc0LTAuODczLDMuNzk2LTIsN2MyLjM1OS0wLjc2NCw2LjkxMS0xLjk3MSw5LDANCgkJCWMwLjY5Nyw1LjM2NC0yLjk1NSw2LjM3OC00LDEwQzg0LjI4OSwyNS4wNDQsODMuNDEsMjQuMjU3LDgzLDIzeiIvPg0KCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTUxLDExYzIuNzI5LTAuNzI5LDIuMDEzLDEuOTg3LDQsMmMtMi42MjIsMS43OTctMi42MjIsNy44OTcsMCw3DQoJCQljLTIuNzgxLDIuMzU3LDAuMjksNS4zODctMiw5YzMuOTE0LDAuNTgxLDUuODA3LTAuODYsOC0yYy0wLjAxMy0xLjk4Ny0yLjcyOS0xLjI3MS0yLTRjMS43MTQsMS4yODYsMy45MzMsMi4wNjcsNCw1DQoJCQljLTMuMjAyLDEuNDY0LTUuNTU3LDMuNzc3LTExLDNjMC0yLjMzMywwLTQuNjY3LDAtN2MtMi45NjgsMS4wMzItMS4yOCw2LjcyLTUsN2MtMC4xNS0yLjQ4MywwLjUxNy00LjE1LDItNQ0KCQkJYzAuMTc0LTIuODQxLTYuNTQyLDEuMjA5LTUtM2MzLjU4OSwwLjU4OSw0LjgzOC0xLjE2Miw3LTJjMC0xLjY2NywwLTMuMzMzLDAtNWMtNC4xMjksMi4yMDQtNy41MjEsNS4xNDYtMTAsOQ0KCQkJYy0yLjA4Mi0zLjEyNyw1LjI4Ni01LjM0NywzLTEyYzMuMDA4LTEuMDA4LDEuNzcyLDIuMjI4LDIsNEM0Ny42OTIsMTUuMDI2LDUxLjc3MiwxNS40MzksNTEsMTF6Ii8+DQoJCTxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMTgsMjRjLTMuMDQzLTMuOTA2LDUuNjM2LTcuMTY1LDItMTJjNS4wNDctMC4yMjIsMi4yNjEsNS4xOTYsMSw3DQoJCQljMy4xNTYsMC40ODksMy41MzEtMS44MDIsNy0xYzQuMDc2LDQuMDcxLDEuMTksMTQuMDIxLTEsMThjLTIuOTMyLTAuMDY3LTMuNzE0LTIuMjg2LTUtNGMtMi43MTEsMC42MjItMi40ODksNC4xNzgtNiw0DQoJCQljMi4yMDctMy40Niw1LjI3NC02LjA2LDctMTBjMi4yNDgsMi4wMDItMS43MTcsNi4yNDEsMiw4YzIuODM0LTIuODMzLDMuMTMtOC4yMDQsMy0xNEMyMy41MjYsMjAuMTkzLDE5Ljc1NSwyMS4wODgsMTgsMjR6Ii8+DQoJCTxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCwyOGM0LjQwMi0xLjU5OCw3LjE5Mi00LjgwOCwxMS03YzEuMzgtNC43MjktMy4xMzItNi41NzQtMS05DQoJCQljMi4wMDUsMS42NjIsNC42NDgsMi42ODUsNSw2Yy0yLjI1OSwyLjg0Mi00LjI1LDExLjEzNywwLDEyYzQuNjIsMC4yODYsMS4zOC03LjI4Niw2LTdjLTAuODc3LDMuNDU2LTEuNzM5LDYuOTI4LTQsOQ0KCQkJYy0yLjQ4OCwwLjE1NC0zLjA5Ni0xLjU3MS01LTJjLTAuOTU4LDMuMDQxLDIuMTQyLDEwLjE0Mi0yLDEwYy0wLjYzMy0zLjM2NywxLjI4OS05LjI4OC0xLTExYy0wLjg4LDIuNDUzLTAuOSw1Ljc2Ny00LDYNCgkJCWMtMC43NTctMy44MTMsNC43OTYtNi40NjEsMi05Yy0xLjcxLDEuNjIzLTMuNjQsMy4wMjctNywzQzAsMjguNjY3LDAsMjguMzMzLDAsMjh6Ii8+DQoJPC9nPg0KPC9nPg0KPC9zdmc+DQo=";

    byte[] bytes = Convert.FromBase64String(ww);
    var aa = Encoding.UTF8.GetString(bytes);
    System.Console.WriteLine(aa);
    // var width = int.Parse(GetMiddleVal(aa, "width=\"", "px"));
    // var height = int.Parse(GetMiddleVal(aa, "height=\"", "px"));
    // using (Bitmap bitmap = new Bitmap(width, height))
    // {
    //   using (Graphics g = Graphics.FromImage(bitmap))
    //   {
    //     //1.打开文件
    //     //SvgDocument svgDocument = SvgDocument.Open("C:\\Users\\YOLO\\Desktop\\aa.svg");
    //     //2.打开svg数据
    //     SvgDocument svgDocument = SvgDocument.FromSvg<SvgDocument>(aa);
    //     ISvgRenderer renderer = SvgRenderer.FromGraphics(g);
    //     svgDocument.Width = width;
    //     svgDocument.Height = height;
    //     svgDocument.Draw(renderer);
    //     g.Dispose();
    //   }
    //   bitmap.Save($"./{DateTime.Now:yyyyMMddHHmmss}.jpg", ImageFormat.Jpeg);
    //   //释放资源以避免 GDI+ 问题
    //   bitmap.Dispose();
    // }
}
static string GetMiddleVal(string source, string s1, string s2)
{
    var res1 = source.Split(new[] { s1 }, StringSplitOptions.RemoveEmptyEntries);
    var res2 = res1[1].Split(new[] { s2 }, StringSplitOptions.RemoveEmptyEntries)[0];
    return res2;
}

static void M42()
{
    // var ww = "1238888888dhdhdhh228";
    // var aa = ww.TrimStart("123".ToArray());
    // aa = aa.TrimStart('8');
    // System.Console.WriteLine(aa);
    // System.Console.WriteLine("1".ToString("0000"));
    System.Console.WriteLine(TimeSpan.MaxValue);
}

static void M43()
{
    var aa = JsonConvert.DeserializeObject<KeyValuePair<string, string>[]>(
        File.ReadAllText("./mapper.txt")
    );
}

static void M44()
{
    System.Console.WriteLine("你是我心内的一首歌");
}

void M45()
{
    var ss = (DateTime?)null;
    System.Console.WriteLine(ss + "2222");
}

void M46()
{
    // var pageIndex = 100000;
    // var ww = (int)Math.Ceiling(10202394 / (double)pageIndex);
    // System.Console.WriteLine(10202394 / pageIndex);
    // System.Console.WriteLine(ww);

    var now = DateTime.Now;

    var timestamp = DateTime.Now - now;

    System.Console.WriteLine(timestamp.Seconds);
}

async void M47()
{
    var url =
        "http://127.0.0.1:3000/api/Report/Print/Content?reportId=b804d9dd-ff06-4d2d-383c-08d9f112c1d6&format=pdf&version=122304#toolbar=0&navpanes=0&scrollbar=0";
    using var http = new HttpClient();
    var content = await http.GetAsync(url);
    var stream = content.Content.ReadAsStream();
    using var pdf = new FileStream(
        $".\\{DateTimeOffset.Now:yyyyMMddHHmmss}.pdf",
        FileMode.OpenOrCreate,
        FileAccess.Write
    );
    var buffer = new byte[stream.Length];
    await stream.ReadAsync(buffer, 0, buffer.Length);
    await pdf.WriteAsync(buffer, 0, buffer.Length);
}

async void M48()
{
    // 1
    // var list = GetEnums().ToList();
    // System.Console.WriteLine(list.ToJson());

    // IEnumerable<string> GetEnums()
    // {
    //     yield return "yellow";
    //     yield return "Black";
    //     yield break;
    //     yield return "Gray";
    //     yield return "Red";
    // }

    // 2
    // var aa = new List<int> { 451, 676, 7865, 675, 5643, 52, 45321, 54, 767, 876, 97, 68, 5676, 54643 };
    // var bb = aa.GetFilterItems();
    // var cc = bb.First();
    // var dd = bb.ToJson();
    // System.Console.WriteLine(bb.ToJson());

    // 3
    var aa = new List<int>
    {
        451,
        676,
        7865,
        675,
        5643,
        52,
        45321,
        54,
        767,
        876,
        97,
        68,
        5676,
        54643
    };
    var nums = aa.GetNumbers(3);
    System.Console.WriteLine(nums.ToJson());
}

async void M49()
{
    using var ff = File.Open("F:\\Projs\\西藏极光\\HIS集成文档.pdf", FileMode.Open);
    var ss = new byte[4];
    var aa = ff.Read(ss, 0, 4);
    var bb = Encoding.Default.GetString(ss);
    var cc = ss[0].ToString() + ss[1].ToString();
    System.Console.WriteLine(aa);
    System.Console.WriteLine(bb);
    System.Console.WriteLine(cc);
}

async void M50()
{
    System.Console.WriteLine("程序开始...");
    var now = DateTime.Now;
    await Task.Delay(3000);
    System.Console.WriteLine("程序结束，耗时：" + (DateTime.Now - now).TotalMilliseconds);
}

void M51()
{
    var ww = new List<string> { "2", "dwwd", "2fe" };
    ww.Remove("33");
    System.Console.WriteLine(ww.ToJson());
}

void M52()
{
    var ww = double.Parse("2.3");
    System.Console.WriteLine((int)ww);
}

void M53()
{
    var ww = new Book
    {
        Id = "PL28394",
        BookName = "高级程序设计",
        Price = 56,
        Category = "读者",
        Author = "华天晓"
    };
    var dt = ww.ToDataTable();
    System.Console.WriteLine(dt.ToXml());
}

void M54()
{
    Guid ww = default;
    System.Console.WriteLine(ww);
}

void M55()
{
    new Program3().Main(null);
}

void M56()
{
    using var md5 = System.Security.Cryptography.MD5.Create();
    var buffer = md5.ComputeHash(
        Encoding.UTF8.GetBytes("123456Arrival1b89e052b6b54d3281ad1c51834363a4")
    );
    var id = BitConverter.ToString(buffer);
    var result = id.Replace("-", "");
    System.Console.WriteLine(result);
}

void M57()
{
    // int WW = 2802498299;
}

void M58()
{
    var ww = new DateTime(2020, 7, 4);
    var ts = DateTime.Now - ww;
    System.Console.WriteLine(ts.TotalDays);
    System.Console.WriteLine(ts.Days);
    System.Console.WriteLine(ts.Days / 365);
}

void M59()
{
    Log("这里是日志");
}

void M60()
{
    var ww = JsonConvert.DeserializeObject<D>("{id:1,name:\"孙小双\",code:null}");
    System.Console.WriteLine(ww.ToJson());
}

void M61()
{
    var ss = new E();
    var method = ss.GetType().GetMethod("Hello");
    var ps = method.GetParameters();
    // ps.Select(a =>
    // {
    //     var p = a.CustomAttributes.FirstOrDefault(a => a.AttributeType == typeof(EAttribute));
    //     if (p == null) return null;
    //     var name = p.

    // });
    method.Invoke(ss, null);
}

void M62()
{
    ActionBlock<int> ww =
        new(async a =>
        {
            await Task.Delay(1000);
            System.Console.WriteLine(a);
        });
    int num = 0;
    while (true)
    {
        ww.Post(num++);

        if (num > 100)
            break;
    }
}

void M63()
{
    System.Console.WriteLine(DateTime.Now.ToString("yyMMdd"));
}

void M64()
{
    int ww = 1657032978;
    System.Console.WriteLine(ww);
}

void M65()
{
    var db = new SxsDbContext();
    db.Database.EnsureCreated();
    System.Console.WriteLine("创建成功");
}

void M66()
{
    System.Console.WriteLine(ConvertGCJPoint(114.457215, 30.505945));
}

async void M67()
{
    using var client = new HttpClient();
    var url =
        "http://localhost:5100/api/order/paperorder?orderId=ab291482-061c-493d-0764-08da663e216b";
    var filepath = "./cs.png";
    var content = new MultipartFormDataContent();
    //添加字符串参数，参数名为qq
    // content.Add(new StringContent("ab291482-061c-493d-0764-08da663e216b"), "orderId");
    content.Add(new ByteArrayContent(File.ReadAllBytes(filepath)), "Content", "cs.png");
    var result = client.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;
    Console.WriteLine(result);
}

void M68()
{
    // 创建连接工厂
    var factory = new ConnectionFactory
    {
        UserName = "pacs",
        Password = "pacs",
        HostName = "81.69.10.164",
        VirtualHost = "RIS"
    };
    // 创建连接
    var connection = factory.CreateConnection();
    // 创建通道
    var channel = connection.CreateModel();
    // 事件基本消费者
    var consumer = new EventingBasicConsumer(channel);
    consumer.Received += (ch, ea) =>
    {
        var message = Encoding.UTF8.GetString(ea.Body.Span);
        System.Console.WriteLine($"收到消息: {message}");
        channel.BasicAck(ea.DeliveryTag, false);
    };
    channel.BasicConsume("ris.third.pacs", false, consumer);
    System.Console.WriteLine("消费者已启动...");
}

void M69()
{
    System.Console.WriteLine((int)DateTime.Now.DayOfWeek);
    System.Console.WriteLine((int)new DateTime(2022, 8, 13).DayOfWeek);
    System.Console.WriteLine(((int)DateTime.Today.DayOfWeek - 1 + 7) % 7);
    System.Console.WriteLine(DateTime.Today.Date.AddDays(7).ToShortDateString());
}

void M70()
{
    var s =
        "http://192.168.2.17:80/PacsIntegration/PacsReportEntry?orderId=defe9952-c527-4293-dd8d-08da7c3a361c&staffId=ba297cc3-55c5-4ac3-8ffb-08da3408c3c1";
    var ww = s.Split("/PacsIntegration");
    System.Console.WriteLine("/PacsIntegration" + ww[1]);
}

void M71()
{
    var str = "OU,眼部,643001,试镜（*）,20.00";
    var ww = str.Split(',', '，');
    System.Console.WriteLine(ww.Length);
}

void M72()
{
    string content = "https://www.baidu.com";

    try
    {
        BarcodeWriter writer = new BarcodeWriter
        {
            Format = BarcodeFormat.QR_CODE,
            Options = new QrCodeEncodingOptions()
            {
                DisableECI = true,
                //设置内容编码
                CharacterSet = "UTF-8",
                //设置二维码的宽度和高度
                Width = 300,
                Height = 300,
                //设置二维码的边距,单位不是固定像素
                Margin = 1
            }
        };

        Bitmap bitmap = writer.Write(content);
        bitmap.Save($"./{DateTime.Now:yyyyMMddHHmmss}.jpg", ImageFormat.Jpeg);
    }
    catch (Exception exception) { }
}

void M73()
{
    var ss =
        "eyJPcmRlcklkIjoiMzExNjEyODEwMTczNDUwOTciLCJVc2VyTmFtZSI6Iuaut atpuaIkCIsIlVzZXJTZXgiOjEsIlVzZXJQaG9uZSI6IjE1ODI2NTY0MTc5IiwiSXNJRENhcmQiOjEsIlVzZXJQaG90byI6IiIsIkxhdCI6MzAuNTM4NTA3LCJMbmciOjExNC4yMTA2NywiUG9zaXRpb25VcmwiOiJ5eGYuYml6L3F0QnVCbmQifQ==";
    ss = ss.Trim().Replace("%", "").Replace(",", "").Replace(" ", "+");
    if (ss.Length % 4 > 0)
    {
        ss = ss.PadRight(ss.Length + 4 - ss.Length % 4, '=');
    }
    var ww = Convert.FromBase64String(ss);
    var aa = Encoding.UTF8.GetString(ww);

    System.Console.WriteLine(aa);

    var w = Convert.ToBase64String(Encoding.Default.GetBytes(aa));
    System.Console.WriteLine(w);
}

async void M74()
{
    using var conn = new SqlConnection("server=81.69.10.164;database=sunxsh;uid=sa;pwd=99@99.com;");
    conn.Open();
    var command = conn.CreateCommand();
    command.CommandText = "select * from Student";
    var reader = await command.ExecuteReaderAsync();
    var dt = new DataTable();
    dt.Load(reader);
    var res = dt.Select()
        .Select(
            a =>
                new
                {
                    id = (int)a["Id"],
                    name = a["Name"].ToString(),
                    rowVersion = "0x" + Convert.ToHexString((byte[])a["RowVersion"])
                }
        );

    System.Console.WriteLine(res.ToJson());
}

void M75()
{
    var ww = File.ReadAllText("./aaa.json");
    var www = new { aa = ww };
    System.Console.WriteLine(www.ToJson());
}

async void M76()
{
    // var s = new DateTime(2022,5,27);
    // var e = new DateTime(2021,7,1);
    // var t = s - e ;
    // System.Console.WriteLine(t.Days);

    // return;
    using var http = new HttpClient();
    var content = new StreamContent(File.Open("20220216141947.pdf", FileMode.Open));
    var res = await http.PostAsync(
        "http://localhost:8765/ThirdPartyApi/ThirdPart/UploadFileV2/123",
        content
    );
    var result = await res.Content.ReadAsStringAsync();
}

async void M77()
{
    var list = new Sunxsh[]
    {
        new("孙小双", 12, "1"),
        new("李四", 12, "2"),
        new("王五", 45, "1"),
        new("另一", 67, "13"),
        new("唐二", 834, "1"),
        new("张三", 1, "12"),
        new("赵六", 22, "d1"),
    };

    var ww = list.Distinct();
}

void M78()
{
    System.Console.WriteLine(20.2353.ToString("0.0"));
}

void M79()
{
    var list = new Sunxsh[]
    {
        new("孙小双", 12, "1"),
        new("李四", 12, "2"),
        new("王五", 45, "1"),
        new("另一", 67, "13"),
        new("唐二", 834, "1"),
        new("张三", 1, "12"),
        new("赵六", 22, "d1"),
    };
    ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
    using var package = new ExcelPackage("./123.xlsx");
    var sheet = package.Workbook.Worksheets.Add("Sheet1");
    sheet.Cells[1, 1].Value = "序号";
    sheet.Cells[1, 2].Value = "学校";
    sheet.Cells[1, 3].Value = "";
    sheet.Cells[1, 4].Value = "姓名";
    sheet.Cells[1, 2, 1, 3].Merge = true;
    package.Save();
}

void M81()
{
    var xml = File.ReadAllText("./1.xml");
    xml = Regex.Replace(xml, @"<\?xml.+\?>", "").Trim();
    var doc = new XmlDocument();
    doc.LoadXml(xml);
    var json = JObject.Parse(JsonConvert.SerializeXmlNode(doc));
    var res = json[json.First.Path]["controlActProcess"];
    var nodes = ParseList(res["subject"], "observationRequest");
    if (!nodes.Any())
        return;
    var orders = new List<HISRISOrderDTO>();
    foreach (var item in nodes)
    {
        var dto = new HISRISOrderDTO
        {
            HisOrderCode = item["id"]?["item"]?["@extension"]?.Value<string>(),
            HisOrderStatus = item["statusCode"]?["@code"]?.Value<string>(),
            EmergencyDegree = item["priorityCode"]?["@code"]?.Value<string>(), // 1急诊 0平诊
            EmergencyDegreeName = item["priorityCode"]?["displayName"]?["@value"]?.Value<string>(), // 1急诊 0平诊
            HisOrderRequestDate = item["author"]?["time"]?["@value"]?.Value<string>(), // 开单时间
            ApplyDoctorCode = item["author"]?["assignedEntity"]?["id"]?["item"]?[
                "@extension"
            ]?.Value<string>(), // 开单医生编码
            ApplyDoctorName = item["author"]?["signatureText"]?["@value"]?.Value<string>(), // 开单医生名称
            OrderDeaprtmentCode = item["author"]?["assignedEntity"]?["representedOrganization"]?[
                "id"
            ]?["item"]?["@extension"]?.Value<string>(), // 申请科室编码
            OrderDeaprtmentName = item["author"]?["assignedEntity"]?["representedOrganization"]?[
                "name"
            ]?["item"]?["part"]?["@value"]?.Value<string>(), // 申请科室名称
            TotalCosts = item["coverage"]?["coverageRecord"]?["id"]?["item"]?[
                "@extension"
            ]?.Value<string>(),
            PatientType = item["componentOf1"]
                ?["encounter"]?["code"]?["@code"]?.Value<string>()
                .ToPatientType(),
            PatientName = item["componentOf1"]?["encounter"]?["subject"]?["patient"]?[
                "patientPerson"
            ]?["name"]?["item"]?["part"]["@value"]?.Value<string>(),
            Telephone = item["componentOf1"]?["encounter"]?["subject"]?["patient"]?[
                "patientPerson"
            ]?["telecom"]?["item"]?["@value"]?.Value<string>(),
            Gender = item["componentOf1"]
                ?["encounter"]?["subject"]?["patient"]?["patientPerson"]?[
                    "administrativeGenderCode"
                ]?["@code"]?.Value<string>()
                .ToGender(),
            Birthday = item["componentOf1"]?["encounter"]?["subject"]?["patient"]?[
                "patientPerson"
            ]?["birthTime"]?["@value"]?.Value<string>(),
            Age = item["componentOf1"]
                ?["encounter"]?["subject"]?["patient"]?["patientPerson"]?["birthTime"]?[
                    "@value"
                ]?.Value<string>()
                .ToAge(),
            AgeUnit = item["componentOf1"]
                ?["encounter"]?["subject"]?["patient"]?["patientPerson"]?["birthTime"]?[
                    "@value"
                ]?.Value<string>()
                .ToAgeUnit(),
            Address = item["componentOf1"]?["encounter"]?["subject"]?["patient"]?["patientPerson"]?[
                "addr"
            ]?["item"]?["part"]?["@value"]?.Value<string>(),
            BedNo = item["componentOf1"]?["encounter"]?["location"]?["serviceDeliveryLocation"]?[
                "location"
            ]?["name"]?["item"]?["part"]?["@value"]?.Value<string>(),
            RoomNo = item["componentOf1"]?["encounter"]?["location"]?["serviceDeliveryLocation"]?[
                "location"
            ]?["asLocatedEntityPartOf"]?["location"]?["name"]?["item"]?["part"]?[
                "@value"
            ]?.Value<string>(),
            RoomNumber = item["componentOf1"]?["encounter"]?["location"]?[
                "serviceDeliveryLocation"
            ]?["serviceProviderOrganization"]?["asOrganizationPartOf"]?["wholeOrganization"]?[
                "id"
            ]?["item"]?["@extension"]?.Value<string>(),
            Sign = item["subjectOf6"]?["annotation"]?["tj"]?["@value"]?.Value<string>(),
            LaboratoryReport = item["subjectOf6"]?["annotation"]?["hytj"]?[
                "@value"
            ]?.Value<string>(),
            HISNote = item["subjectOf6"]?["annotation"]?["text"]?["@value"]?.Value<string>(),
            Apoplexy = item["priorityCode"]?["apoplexy"]?["@value"]?.Value<string>(),
            DaySurgery = item["priorityCode"]?["daySurgery"]?["@value"]?.Value<string>(),
        };

        fillCheckItems(item["component2"], dto);
        fillPatientInfo(item, dto);
        fill(item, dto);
        orders.Add(dto);
    }

    System.Console.WriteLine(1);

    // 处理检查项目
    void fillCheckItems(JToken checkItems, HISRISOrderDTO dto)
    {
        if (!checkItems.Any())
            return;
        var bodyParts = new List<string>();
        var checkCodes = new List<string>();
        var checkNames = new List<string>();
        var costs = new List<string>();

        var list = ParseList(checkItems, "observationRequest");
        list.ForEach(handle);
        dto.OrderExamCode = string.Join("|", checkCodes);
        dto.OrderExamname = string.Join("|", checkNames);
        dto.ExamCosts = string.Join("|", costs);
        dto.HISBodyPartName = string.Join(",", bodyParts.Distinct());
        dto.HisExamName = string.Join(",", checkNames);

        void handle(JToken checkItem)
        {
            checkCodes.Add(checkItem["code"]["@code"].Value<string>());
            checkNames.Add(checkItem["code"]["displayName"]["@value"].Value<string>());
            bodyParts.Add(
                checkItem["targetSiteCode"]["item"]["displayName"]["@value"].Value<string>()
            );
            costs.Add(
                checkItem["pertinentInformation"][1]["observation"]["code"]["displayName"][
                    "@value"
                ].Value<string>()
            );

            if (dto.ExamDeaprtmentCode != null)
                return;
            var codes = ParseList(
                checkItem["location"]
                    ?["serviceDeliveryLocation"]
                    ?["serviceProviderOrganization"]
                    ?["id"],
                "item"
            );
            dto.ExamDeaprtmentCode = codes
                .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.1.26")
                ?["@extension"]?.Value<string>();
            dto.ExamDeaprtmentName = checkItem["location"]?["serviceDeliveryLocation"]?[
                "serviceProviderOrganization"
            ]?["name"]?["item"]?["part"]?["@value"]?.Value<string>();
        }
    }
    // 处理患者部分信息
    void fillPatientInfo(JToken item, HISRISOrderDTO dto)
    {
        var list = ParseList(
            item["componentOf1"]?["encounter"]?["subject"]?["patient"]?["id"],
            "item"
        );
        // 患者编号
        dto.GloablePatientid = list.FirstOrDefault(
            a => a["@root"].Value<string>() == "2.16.156.10011.2.5.1.4"
        )
            ?["@extension"].Value<string>();
        dto.HisPatientId = dto.GloablePatientid;
        // 住院号
        dto.InhospitalNumber = list.FirstOrDefault(
            a => a["@root"].Value<string>() == "2.16.156.10011.1.12"
        )
            ?["@extension"].Value<string>();
        // 病案号
        dto.MedicalRecordNumber = list.FirstOrDefault(
            a => a["@root"].Value<string>() == "2.16.156.10011.1.18"
        )
            ?["@extension"].Value<string>();
        // 门诊卡号
        dto.ClinicNumber = list.FirstOrDefault(
            a => a["@root"].Value<string>() == "2.16.156.10011.1.19"
        )
            ?["@extension"].Value<string>();

        var componentOf1 = ParseList(
            item["componentOf1"]?["encounter"]?["subject"]?["patient"]?["patientPerson"]?["id"],
            "item"
        );
        // 身份证号
        dto.IdCard = componentOf1
            .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.1.3")
            ?["@extension"].Value<string>();
        // 医保卡号
        dto.SocietyNumber = componentOf1
            .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.1.15")
            ?["@extension"].Value<string>();
        // 就诊卡号
        dto.VisitNumber = componentOf1
            .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.2.5.1.6")
            ?["@extension"].Value<string>();

        var componentOf2 = ParseList(item["componentOf1"]?["encounter"]?["id"], "item");
        // 就诊流水号
        dto.VisitSerialNumber = componentOf2
            .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.2.5.1.9")
            ?["@extension"].Value<string>();
        dto.PreIHFlag = componentOf2
            .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.2.5.1.20")
            ?["@extension"].Value<string>();
        dto.PreDiagnose = componentOf2
            .FirstOrDefault(a => a["@root"].Value<string>() == "2.16.156.10011.2.5.1.20")
            ?["@value"].Value<string>();
    }
    // 处理其他的信息
    void fill(JToken item, HISRISOrderDTO dto)
    {
        var components = ParseList(item["pertinentInformation"]?["organizer"], "component");
        dto.PastHistory = components
            .FirstOrDefault(a => a["observation"]?["code"]?["@code"]?.Value<string>() == "01")
            ?["observation"]?["code"]?["originalText"]?["@value"]?.Value<string>();
        dto.Note = components
            .FirstOrDefault(a => a["observation"]?["code"]?["@code"]?.Value<string>() == "05")
            ?["observation"]?["code"]?["originalText"]?["@value"]?.Value<string>();
        dto.ClinicalDiagnosis = components
            .FirstOrDefault(a => a["observation"]?["code"]?["@code"]?.Value<string>() == "08")
            ?["observation"]?["code"]?["originalText"]?["@value"]?.Value<string>();
    }
    // 将本该是数组的json对象转化为列表（因为xml中数组对象只存在一个元素时，json可能会将其认为是一个对象）
    List<JToken> ParseList(JToken json, string listFlag)
    {
        var items = json?[listFlag];
        if (json == null || items == null)
            return new List<JToken>();
        var list = new List<JToken>();
        if (items.GetType() == typeof(JObject))
        {
            list.Add(items);
        }
        else
        {
            foreach (var obj in items)
            {
                list.Add(obj);
            }
        }
        return list;
    }
}

void M82()
{
    var xml = File.ReadAllText("./1.xml");
    var mappingJson = JObject.Parse(File.ReadAllText("./query.json"));
    xml = Regex.Replace(xml, @"<\?xml.+\?>", "").Trim();
    var doc = new XmlDocument();
    doc.LoadXml(xml);
    var json = JObject.Parse(JsonConvert.SerializeXmlNode(doc));
    var nodes = json.SelectToken($"{json.First.Path}.controlActProcess.subject").ToList();

    var dtos = nodes
        .Select(node => handle<HISRISOrderDTO>(node["observationRequest"], mappingJson))
        .ToList();

    System.Console.WriteLine("1");

    // 根据映射表，设置对象的值，并返回对象
    T handle<T>(JToken node, JObject mappings)
        where T : class, new()
    {
        var dto = new T();

        foreach (var mapping in mappings)
        {
            var key = mapping.Key; // 当前字段的名称
            var val = mapping.Value;
            if (key.StartsWith("$")) // 以 $ 开头的字段，需要特殊处理
            {
                specialHandle(key, val, dto, node);
                continue;
            }
            var path = val["path"].Value<string>(); // 节点路径
            var type = val["type"]?.Value<string>(); // 需要转化的类型
            var id = val["id"]?.Value<string>(); // 从数组中查询指定元素的id（路径|id）
            var value = val["value"]?.Value<string>(); // 节点取值的路径
            var clone = val["clone"]?.Value<string>(); // 需要克隆的字段
            var element = node.SelectToken(path); // 根据路径，找到对应的节点
            if (element == null)
                continue;
            if (id == null)
            {
                // 如果id为空，则表示该节点必定不是数组，如果json中仍表示为数组，则取数组的第一项
                if (element is JArray)
                    element = element.ToList().First();
            }
            else
            {
                // 此节点为数组，需要根据id获取指定的元素
                var arr = id.Split('|');
                var field = arr[0];
                var idValue = arr[1];
                // 在数组中查询指定id的节点
                var idElement = element
                    .ToList()
                    .FirstOrDefault(item => item.SelectToken(field)?.Value<string>() == idValue);
                if (idElement == null)
                    continue;
                element = idElement;
            }
            // 读取节点的值
            var elementValue = string.IsNullOrWhiteSpace(value)
                ? element.Value<string>()
                : element.SelectToken(value)?.Value<string>();
            elementValue = elementValue.Parse(type); // 根据类别做必要的转化
            dto.SetValue(key, elementValue); // 给对象赋值
            if (string.IsNullOrWhiteSpace(clone))
                continue;
            // 克隆到其他的字段
            var fileds = clone.Split('|');
            foreach (var item in fileds)
            {
                dto.SetValue(item, elementValue);
            }
        }

        return dto;
    }

    // key值已 $ 开头的字段需要特殊处理
    void specialHandle(string key, JToken para, object obj, JToken node)
    {
        // 检查项目特殊处理
        if (key == "$CheckItem")
        {
            var items = node.SelectToken(para["path"].Value<string>()).ToList(); // 首先取到所有的检查项目节点
            if (items == null)
                return;
            var mappings = para["mapping"] as JObject; // 检查项目对应的映射表
            // 将节点转化为检查项目列表
            var checkItems = items.Select(item => handle<HISProcedure>(item, mappings)).ToList();
            if (checkItems == null)
                return;
            // 给对象赋值
            var dto = obj as HISRISOrderDTO;
            dto.OrderExamCode = string.Join("|", checkItems.Select(a => a.Code));
            dto.OrderExamname = string.Join("|", checkItems.Select(a => a.Name));
            dto.ExamCosts = string.Join("|", checkItems.Select(a => a.Cost));
            dto.HISBodyPartName = string.Join("|", checkItems.Select(a => a.Bodypart));
            dto.HisExamName = string.Join("|", checkItems.Select(a => a.Name));
            // 仅取一个项目的检查科室
            var hasExamDeptItem = checkItems.FirstOrDefault(
                a => !string.IsNullOrEmpty(a.ExamDeptCode)
            );
            dto.ExamDeaprtmentCode = hasExamDeptItem?.ExamDeptCode;
            dto.ExamDeaprtmentName = hasExamDeptItem?.ExamDeptName;
        }
    }
}

void M83()
{
    ConnectionMultiplexer redisClient = ConnectionMultiplexer.Connect(
        "192.168.200.160:6379,abortConnect=false,password=hinacom"
    );
    IDatabase db = redisClient.GetDatabase();
    string value = "abcdefg";
    db.StringSet("mykey", value, new TimeSpan(0, 0, 0));
    value = db.StringGet("mykey");
    Console.WriteLine(value);

    Console.ReadKey();
}

void M84()
{
    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

    using (StreamWriter writer = new StreamWriter("./PrivateKey.xml")) //这个文件要保密...
    {
        writer.WriteLine(rsa.ToXmlString(true));
    }
    using (StreamWriter writer = new StreamWriter("./PublicKey.xml"))
    {
        writer.WriteLine(rsa.ToXmlString(false));
    }
}

async Task M85()
{
    var url = "http://localhost:5301/File";
    var client = new HttpClient();
    var obj = new { content = File.ReadAllBytes("./cs.png"), type = 2 };
    var content = new StringContent(JsonConvert.SerializeObject(obj));
    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
    var ww = await client.PostAsync(url, content);
    var aa = await ww.Content.ReadAsStringAsync();
}

void M86()
{
    var aa = new { Name = "孙小双", age = 22 };
    var json = JsonConvert.SerializeObject(aa);
    var bb = JObject.Parse(json);
    bb["BabyName"] = "孙思怡";
    bb["age"] = 22;
    System.Console.WriteLine("DDDDDD" + bb.ToString());
}

void M87()
{
    var ww = "50022545451|1";
    // ww = ww.TrimEnd('|', '1');
    ww = ww.TrimEnd('1');
    ww = ww.TrimEnd('|');
    System.Console.WriteLine(ww);
}

void M88()
{
    var conn = ConnectionMultiplexer.Connect(
        "81.69.10.164:6379,password=jiandanmaokeji,connectTimeout=1000,connectRetry=1,syncTimeout=10000"
    );
    conn.GetSubscriber()
        .Subscribe(
            "eventbus",
            (channel, val) =>
            {
                System.Console.WriteLine($"channel: {channel}, val: {val}");
            }
        );
    while (true)
    {
        var val = Console.ReadLine();
        conn.GetSubscriber()
            .Publish(
                "eventbus",
                JsonConvert.SerializeObject(
                    new
                    {
                        EventId = "ToDo:Create1",
                        Payload = new { name = "孙小双", age = 22 },
                        CreatedTime = DateTimeOffset.Now
                    }
                )
            );
    }
}

async void M89()
{
    var task1 = Task.Run(() =>
    {
        while (true)
        {
            try
            {
                var factory = new ConnectionFactory
                {
                    Uri = new Uri("amqp://huasky:huasky@81.69.101.164:5672/huasky"), //new Uri($"http://81.69.10.164:5672/huasky"),
                    AutomaticRecoveryEnabled = true,
                    NetworkRecoveryInterval = TimeSpan.FromSeconds(10),
                };
                var conn = factory.CreateConnection();
                var channel = conn.CreateModel();
                break;
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("错误:" + ex.Message);
                Task.Delay(1000).Wait();
            }
        }
    });
    var task2 = Task.WhenAny(task1, Task.Delay(5000));
    while (true)
    {
        System.Console.WriteLine($"task1: {task1.IsCompleted}, task2: {task2.IsCompleted}");
        Task.Delay(2000).Wait();
    }
}

void M90()
{
    var xml = File.ReadAllText("./11111.xml");
    // 体检读取申请单时，可能出现头部有特殊字符
    var xmlHeader = xml.Substring(0, 5);
    var index = xmlHeader.IndexOf("<");
    xml = xml.Substring(index);
    xml = Regex.Replace(xml, @"<\?xml.+\?>", "").Trim();
    var doc = new XmlDocument();
    doc.LoadXml(xml);
    var aa = JObject.Parse(JsonConvert.SerializeXmlNode(doc));
}

void M91()
{
    var xml = File.ReadAllText("./11111.xml");

    var doc = new XmlDocument();
    doc.LoadXml(xml);
}

void M92()
{
    System.Console.WriteLine(12.1.ToString("0.0"));
    System.Console.WriteLine(Math.Round(55.32345, 2));
}

void M93()
{
    var aa = "1123";
    var bb = JsonConvert.SerializeObject(aa);
    var cc = JsonConvert.DeserializeObject<string>(bb);
    System.Console.WriteLine(bb);
    System.Console.WriteLine(cc);
}


void Log(
    string msg,
    [CallerMemberName] string memberName = "",
    [CallerFilePath] string sourceFilePath = "",
    [CallerLineNumber] int sourceLineNumber = 0
)
{
    System.Console.WriteLine($"打印信息：{msg}, {memberName}, {sourceFilePath}, {sourceLineNumber}");
}

/// <summary>
/// 将百度坐标转化为火星坐标
/// </summary>
/// <param name="lng">经度</param>
/// <param name="lat">纬度</param>
/// <returns></returns>
static (double, double) ConvertGCJPoint(double lng, double lat)
{
    var x_pi = 3.14159265358979324 * 3000.0 / 180.0;
    double x = lng - 0.0065,
        y = lat - 0.006;
    double z = Math.Sqrt(x * x + y * y) - 0.00002 * Math.Sin(y * x_pi);
    double theta = Math.Atan2(y, x) - 0.000003 * Math.Cos(x * x_pi);
    return (z * Math.Cos(theta), z * Math.Sin(theta));
}

class D
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Code { get; set; } = "sunxsh";
}

class A
{
    public void Say()
    {
        System.Console.WriteLine("我是A");
    }

    public virtual void Say2()
    {
        System.Console.WriteLine("我是A2");
    }
}

class B : A
{
    public new void Say()
    {
        System.Console.WriteLine("我是B");
        base.Say();
    }

    public override void Say2()
    {
        System.Console.WriteLine("我是B2");
        base.Say2();
    }
}

class Person
{
    [BsonId]
    [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
    public string Id { get; set; }
    public string Name { get; set; }
    public int? Sort { get; set; }
}

class Book
{
    [BsonId]
    [BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
    public string Id { get; set; }

    [BsonElement("Name")]
    public string BookName { get; set; }
    public decimal Price { get; set; }
    public string Category { get; set; }
    public string Author { get; set; }
}

enum OrderStatus
{
    Arrival = -1,
    Pay,
    Cancel,
    Eatting
}

class C1
{
    public bool? IsFinish { get; set; }
}

class MyDbContext : DbContext
{
    public DbSet<C1> Blogs { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(@"Server=81.69.10.164;Database=HTX001;user=sa;pwd=99@99.com");
    }
}

static class MyStaticCls
{
    public static IEnumerable<int> GetFilterItems(this IEnumerable<int> data, int count = 2)
    {
        var num = 0;
        foreach (var item in data)
        {
            if (item % 2 == 0)
            {
                yield return item;
                num++;
            }
            if (num == count)
                yield break;
        }
    }

    public static IEnumerable<int> GetNumbers(this IEnumerable<int> data, int count = 1)
    {
        var num = 0;
        foreach (var item in data)
        {
            if (item % 2 == 0)
            {
                yield return item;
                num++;
            }
            if (num == count)
                yield break;
        }
    }
}

class E
{
    [E]
    public string Say()
    {
        return "Say";
    }

    public string Hello([E] string name)
    {
        return name;
    }
}

#region xml
[System.AttributeUsage(
    AttributeTargets.Parameter
        | AttributeTargets.Class
        | AttributeTargets.Property
        | AttributeTargets.Method,
    Inherited = false,
    AllowMultiple = true
)]
sealed class EAttribute : System.Attribute
{
    public string DefaultName { get; set; }

    public EAttribute(string defaultName = default)
    {
        this.DefaultName = defaultName;
    }
}

class SxsDbContext : DbContext
{
    public DbSet<Person> Person { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer("server=81.69.10.164;database=sunxsh;uid=sa;pwd=99@99.com");
    }
}

record Sunxsh(string Name, int Age, string Code);

[XmlRoot("POOR_IN200901UV")]
public class XmlTest
{
    [XmlAttribute]
    public string ITSVersion { get; set; } = "XML_1.0";

    [XmlAttribute]
    public string xmlns { get; set; } = "urn:hl7-org:v3";

    // [XmlAttribute("xmlns:xsi")]
    // public string xmlnsXsi { get; set; } = "http://www.w3.org/2001/XMLSchema-instance";
    // [XmlAttribute("xsi:schemaLocation")]
    // public string xsiSchemaLocation { get; set; } = "urn:hl7-org:v3 ../multicacheschemas/POOR_IN200901UV.xsd";
    public XmlRoot Id { get; set; } =
        new XmlRoot { extension = "b7722265-cc05-4b72-b3ed-fe54b30a34c4" };
    public XmlValue creationTime { get; set; } = new XmlValue { value = "20210108153405" };
    public XmlRoot interactionId { get; set; } = new XmlRoot { extension = "POOR_IN200901UV" };
    public XmlCode processingCode { get; set; } = new XmlCode { code = "P" };
    public XmlCode processingModeCode { get; set; } = new XmlCode();
    public XmlCode acceptAckCode { get; set; } = new XmlCode { code = "AL" };
    public XmlTypeCode receiver { get; set; } =
        new XmlTypeCode
        {
            typeCode = "RCV",
            device = new XmlClass
            {
                classCode = "DEV",
                determinerCode = "INSTANCE",
                id = new XmlRoot { extension = "ESS" }
            }
        };
}

public class XmlRoot
{
    [XmlAttribute]
    public string root { get; set; } = "2.16.156.10011.2.5.1.1";

    [XmlAttribute]
    public string extension { get; set; }
}

public class XmlValue
{
    [XmlAttribute]
    public string value { get; set; }
}

public class XmlCode
{
    [XmlAttribute]
    public string code { get; set; }
}

public class XmlTypeCode
{
    [XmlAttribute]
    public string typeCode { get; set; }
    public XmlClass device { get; set; }
}

public class XmlClass
{
    [XmlAttribute]
    public string classCode { get; set; }

    [XmlAttribute]
    public string determinerCode { get; set; }
    public XmlRoot id { get; set; }
}

public class XmlResponse
{
    public XmlResponseText acknowledgementDetail { get; set; }
}

public class XmlResponseText
{
    public XmlValue text { get; set; }
}
#endregion
